<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>

        //数组
        //-创建数组有两种方式
        //  ①方括号：C系列语言类似
        //  ②(不推荐)圆括号：创建Array对象的方式
        // (不推荐) let arr = new Array("Tim","Van","Steve");
        //  arr = ["Jobs","Bill","Gates"];

        //JSON格式
        // {
        //     "rewardable": true,
        //     "setting": {
        //          "description": "小礼物走一走，来简书关注我",
        //           "default_amount": 200
        //      },
        //     "total_rewards_count": 0,
        //     "reward_buyers": []
        // }
        let ret = "{\"rewardable\":true,\"setting\":{\"description\":\"小礼物走一走，来简书关注我\",\"default_amount\":200},\"total_rewards_count\":0,\"reward_buyers\":[]}";
        //遍历先用JSON.parse函数，再用 for (let key in data) 方法取出键值对
        let data = JSON.parse(ret);
        for (let key in data){
            document.write(key+"<br>");
            document.write("-- "+data[key]+"<br>");
        }


    </script>
</body>
</html>